package negocio

class BaseSecureController {
    //verifica se o usuario esta logado
    def beforeInterceptor=[action:this.&auth,
        except:['handleLogin','login','handleRegistration','register','handleLoginFacebook','recuperarSenha']

    ]



   def auth(){
       if(!session.user){
           redirect(controller:'usuario',action:'login')
           return false
       }
   }

   public Usuario getUserLogged(){
       return session.user
   }

   def login(Usuario user){
       session.user=user
   }
   def logout(){
       session.invalidate()
   }
}
